package frame.factory;

import frame.core.SqlSession;
import frame.core.SqlSessionImpl;
import frame.pojo.Configuration;

/**
 * FileName: SqlSessionFactory
 * Author:   xuan zongjun
 * Date:     2020/11/4 11:15
 * Description: 工厂类，用于返回SqlSession的实现类对象
 */


public class SqlSessionFactory {

    private Configuration configuration;

    /**
     * 创建sqlSession
     * @return
     */
    public SqlSession openSession(){
        SqlSessionImpl sqlSession = new SqlSessionImpl();
        sqlSession.setConfiguration( configuration );
        return sqlSession;
    }

    public void setConfiguration(Configuration configuration) {
        this.configuration = configuration;
    }
}
